﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YasharEl.Infrastructure.Core.Prototype;

namespace YasharEl.Infrastructure.Core.ServiceModel.Prototype
{
    public static class PropertyValueDTOFactory
    {
        public static IPropertyValueDTO CreateValueContainerDTO(long dataType)
        {
            if (dataType == YasharEl.Infrastructure.Core.Prototype.DataType.Address.Value)
            {
                return new PropertyValueAddressDTO();
            }

            if (dataType == YasharEl.Infrastructure.Core.Prototype.DataType.Boolean.Value)
            {
                return new PropertyValueBooleanDTO();
            }

            if (dataType == YasharEl.Infrastructure.Core.Prototype.DataType.DateTime.Value)
            {
                return new PropertyValueDateTimeDTO();
            }

            if (dataType == YasharEl.Infrastructure.Core.Prototype.DataType.Decimal.Value)
            {
                return new PropertyValueDecimalDTO();
            }

            if (dataType == YasharEl.Infrastructure.Core.Prototype.DataType.Double.Value)
            {
                return new PropertyValueDoubleDTO();
            }

            if (dataType == YasharEl.Infrastructure.Core.Prototype.DataType.Integer.Value)
            {
                return new PropertyValueIntegerDTO();
            }

            if (dataType == YasharEl.Infrastructure.Core.Prototype.DataType.Long.Value)
            {
                return new PropertyValueLongDTO();
            }

            if (dataType == YasharEl.Infrastructure.Core.Prototype.DataType.String.Value)
            {
                return new PropertyValueStringDTO();
            }

            throw new DataTypeEnumerationException(dataType, "DataType not supported.");
        }
    }
}
